<template>
  <div class="Template6__layer"
       :style="{backgroundColor: formData.maskColor, width: ((editorDevice === 'desktop' || editorDevice === 'all') &&  formData.showDevice !== 'mobile') ? '100%' : '375px', transform: ((editorDevice === 'desktop' || editorDevice === 'all') &&  formData.showDevice !== 'mobile') ? 'none': 'scale(0.8)'}">
    <div class="Template6PcWrap" :class="[formData.bgStyle, formData.bgAlignment]"
         :style="{position: 'absolute', transform: 'scale(1)', background: `${formData.imageUrl ? `url(${formData.imageUrl}) center center / cover no-repeat scroll` : `none center center / cover no-repeat scroll ${formData.baseMap1}`}`}"
         >
      <div class="Template6__title_firstPage" v-html="formData.popupTitle"></div>
      <div class="Template6__desc_firstPage" v-html="formData.programme"></div>
      <div class="Template6__btn" :style="{backgroundColor: formData.btnBackgroundColor, borderColor: formData.btnBorderColor}" v-html="formData.btnText"></div>
      <i @click="handleClose" class="jyfont card-col-close icon_custom Template6__close-icon el-icon-close"
         style="color: rgb(255, 255, 255);"></i></div>
    <div class="Template6__mode_edit_b971"></div>
  </div>
</template>

<script>
import {mapGetters} from 'vuex';

export default {
    name: 'MarketingActivities',
    props: {
        formData: {
            type: Object,
            default: () => ({})
        },
        deviceName: {
            type: String,
            default: 'desktop'
        }
    },
    watch: {
        deviceName (newValue) {
            this.editorDevice = newValue;
        },
        editor (newValue) {
            this.editorDevice = newValue;
        }
    },
    data () {
        return {
            editorDevice: 'all'
        };
    },
    computed: {
        ...mapGetters({editor: 'editorDevice'})
    },
    methods: {
        paraseHtml (html) {
            html = html.replace('{{rebate}}', '$5');
            html = html.replace('{{amount}}', '$2');
            return html;
        },
        handleClose () {
            this.$emit('close');
        }
    }
};
</script>

<style lang="scss" scoped>
.Template6__layer {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
  .bg-fill {
    background-repeat: repeat!important;
    background-size: 100% auto !important;
  }
  .bg-stretching {
    background-repeat: repeat!important;
    background-size: 100% 100% !important;
  }
  .bg-tile {
    background-repeat: repeat!important;
    background-size: auto !important;
  }
  .bg-center {
    background-position: center center !important;
  }
  .bg-left-top {
    background-position: left top !important;
  }
  .bg-right-top {
    background-position: right top !important;
  }
  .bg-left-bottom {
    background-position: left bottom !important;
  }
  .bg-right-bottom {
    background-position: right bottom !important;
  }
  .editForm-item-area {
    min-width: 300px!important;
  }
  .Template6PcWrap{
    position: relative;
    padding: 28px 40px;
    width: 370px;
    z-index: 3;
    color: #000;
    background-color: #ff6a64;
    line-height: 1.5;
    text-align: center;
    font-size: 14px;
    border-radius: 5px;
    .Template6__title_firstPage{
      margin: 0 auto;
    }
    .Template6__desc_firstPage{
      margin: 14px auto 0;
    }
    .Template6__btn{
      margin: 20px 60px 0;
      height: 28px;
      line-height: 28px;
      font-size: 14px;
      background-color: #000;
      border: 1px solid #000;
      outline: none;
      cursor: pointer;
    }
    .Template6__close-icon{
      position: absolute;
      top: 10px;
      right: 10px;
      width: 20px;
      height: 20px;
      line-height: 16px;
      font-size: 14px;
      color: #fff;
      cursor: pointer;
    }
  }
}
</style>

<style lang="scss">
.Template6__btn{
  p{
    margin: 0;
  }
}
</style>
